package servlet;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.io.PrintWriter;

/**
 * @author 石小俊
 * @date 2023年06月30日 10:26
 */
@WebServlet("*.test")
public class TestTwoServlet extends HttpServlet {
    protected void service(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        response.setContentType("text/html;charset=utf-8");
        PrintWriter out = response.getWriter();
        // 对于*.xxx的场景,该方法获取的是应用名后面的完整地址
        String servletPath = request.getServletPath();
        System.out.println("servletPath:"+servletPath);
        out.println("<h1 style='color:red;'>*************我进来了************</hr>");
    }
}
